#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

#include <QCheckBox>

#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <QSocketNotifier>
#include <QTimer>
#include <errno.h>
#include "serialData.h"
#include <QDebug>

namespace Ui {
class MainWindow;
}

namespace Ui {
class setupWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    bool openSerial() ;
public slots:
    void closeSerial();
    void readData();
    void sendData();
    void updateData();
    void clearData();
    void startAutoSend();
    void openoprt() ;
signals:
    void serialClosed();
private slots:


    void on_system_setup_button_clicked();

private:
    Ui::MainWindow *ui;

    int fd;
    bool flag     ;
    SerialData      setData;
    QString         revData;
    QTimer      *   autoTimer;
    QSocketNotifier * monitor;

    private slots:
            void widgetshow() ;
};
#if 0
class setupWindow: public QMainWindow
{
    Q_OBJECT
 public:
    explicit setupWindow(QWidget *parent =0);
    ~setupWindow();
  private:
    Ui::setupWindow *ui;
};
#endif
#endif // MAINWINDOW_H
